<?php
/**
 * Created by PhpStorm.
 * User: Yan
 * Date: 2017/10/25
 * Time: 15:03
 */

namespace App\Http\Controllers;


use Illuminate\Http\Request;

class HomeController extends Controller
{

    public function upload(Request $request){
        $file = $request->file('file');
        // 第一个参数代表目录, 第二个参数代表我上方自己定义的一个存储媒介
        $extension = $file->getClientOriginalExtension();
        $savePath = public_path('') . '\files_store';
        $filename =str_random(60).'.' . $extension;
        $file->move($savePath, $filename);
        return json_encode($savePath . '\\' . $filename);
//        $s = fr_get_feature_size('eltwise_fc1');
//        $feature = fr_get_feature($savePath . '\\' . $filename, $s);
       // dd($feature);
//        print_r($feature);

//        return  $feature;
       // return fr_get_capture_similarity("192.168.1.123", 8000, "admin", "12345", $feature, $s);
    }
    public function comparison(Request $request){
//        return 1;
        $feature = $request->get('sn');
        if($feature){
            $s = fr_get_feature_size('eltwise_fc1');
           // dd($feature);
            $feature = fr_get_feature($feature, $s);
            //$feature = fr_get_feature('D:\pictures\jason_face1.jpg', $s);
            return fr_get_multiple_capture_similarity_multi_thread("192.168.1.100", 8000, "admin", "12345", $feature, $s,public_path('') . '\files_store',11, 0.6);
        }

    }


}